<?php
/**
 * 新闻详细页
 * author:wang
 * mail:970633164@qq.com
 */
define("PHP_IN",true);
require "include/init.php";
require ROOT_PATH."smarty_connection.php";

$newsid = isset($_GET['newsid']) ? $_GET['newsid'] : 0 ;
$page = isset($_GET['page']) ? $_GET['page'] : 1;

$sql = "SELECT * FROM news where newsid = $newsid";
$result = $db->query($sql);
if($result && $db->num_rows($result)){
    $news = $db->fetch_one($result);
}else{
    alert("这篇文章不存在","news.php?page=".$page);
}

$smarty->assign("news",$news);
$smarty->assign("page",$page);

$smarty->display("news_defail.tpl");
$db->close();
?>